package com.CMS.server.dao;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import com.CMS.server.domain.PageVersion;

public class PageVersionDao extends BaseDao<PageVersion>{
	
	public PageVersionDao(){
		super();
	}
	
	public PageVersion getVersionActive()
	{
		PageVersion page = null;
		EntityManager em = entityManager();		
		try{			
			Query q  = em.createQuery("select u from PageVersion u "+ 
									  "where u.flag_activa = ?1");
			q.setParameter(1, true);
			page = (PageVersion)q.getSingleResult();
		}
		finally{
			em.close();
		}		
		return page;
	}
}
